// components/bookInfo/bookInfo.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    commentCount:{
      ISBNPrice:String,
      SeriesItems:String,
      abstract:String,
      author:String,
      bookInfo:String,
      bookInfoNow:Array,
      classification:String,
      language:String,
      name:String,
      nameAuthor:String,
      note:String,
      press:String,
      publishedInfo:String,
      publishingCountry:String,
      source:String,
      theme:String,
      title:String,
      translation:String,
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    // 书籍列表
    books: [],
    // 搜索获取总数
    number: "",
    // 搜索获取书籍信息
    bookInfo: [],

  },

  onLoad: function (options) {
    console
  },

  /**
   * 组件的方法列表
   */
  methods: {
    getBook(){
      var that = this
      wx.request({
        url: 'https://example.com/bookinfo',
        dataType: 'json',
        success(res) {
          that.setData({
            books: res.data,
            number: res.data.number,
            bookInfo: res.data.bookInfo
          })     
          console.log(that.data.bookInfo)
          console.log("--------------") 
        }
      })
    },

    // 点击进入详情界面
    goBookItem(e){
      // console.log(e.currentTarget.dataset.item)
      var bookItemInfo = e.currentTarget.dataset.item
      console.log(bookItemInfo)

      wx.setStorageSync("bookInfo",bookItemInfo)
    }
  },

  
})
